<!--%import("filter/delete_checked.xml")-->
<!--%import("css/pagination.css")-->
<h3 class="icoTool">{$dashboard_menus['ManageAd']['title']}</h3>

{@ $oModuleModel = &getModel('module')}

<!-- information -->
<div class="summary">
    <strong>Total</strong> <em>{number_format($total_count)}</em>, Page <strong>{number_format($page)}</strong>/{number_format($total_page)}
</div>

<div class="fl">
    <form action="./" method="get" class="ad-search">
    <input type="hidden" name="module" value="ad" />
    <input type="hidden" name="act" value="dispAdAdminList" />
        <fieldset>
            <select name="search_target">
                <option value="">{$lang->search_target}</option>
                <!--@foreach($lang->_search_target_list as $key => $val)-->
                <option value="{$key}"<!--@if($search_target == $key)--> selected="selected"<!--@end-->>{$val}</option>
                <!--@end-->
            </select>
            <input type="text" name="search_keyword" value="" class="inputText" />
            <span class="buttonAction actionBlue"><input type="submit" value="{$lang->cmd_search}" /></span>
            <span class="buttonAction actionWhite normal"><a href="{getUrl('module','admin','dispAdAdminTotalList')}"><span>{$lang->cmd_cancel}</span></a></span>
        </fieldset>
    </form>
</div>

<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)">
<table cellspacing="0" class="listTable tCenter clear">
    <thead>
    <tr>
        <th scope="row"><input type="checkbox" onclick="XE.checkboxToggleAll(); return false;" /></th>
        <th scope="row">{$lang->status}</th>
        <th scope="row">{$lang->module}</th>
        <th scope="row">{$lang->ad_content}</th>
        <th scope="row">{$lang->ads->author}</th>
        <th scope="row">{$lang->ads->regdate}</th>
    </tr>
    </thead>
    {@ $ModuleInfo = array()}
    <!--@if(count($ad_list)>0)-->
    <!--@foreach($ad_list as $no => $ad)-->
    <!--@if($ModuleInfo[$ad->get('module_srl')])-->
    {@ $curModuleInfo = $ModuleInfo[$ad->get('module_srl')]}
    <!--@else-->
    {@
        $curModuleInfo = $oModuleModel->getModuleInfoByModuleSrl($ad->get('module_srl'));
        $ModuleInfo[$ad->get('module_srl')] = $curModuleInfo;
    }
    <!--@end-->
    {@ $remainingTime = $ad->getRemainingTime()}
    <!--@if($remainingTime)-->
        {@ $publishedStatus = 1}
    <!--@else-->
        <!--@if($ad->get('end_date') == -1)-->
            {@ $publishedStatus = 2}
        <!--@end-->
    <!--@end-->
    <tbody>
    <tr>
        <td><input type="checkbox" name="cart" value="{$ad->document_srl}" /></td>
        <td>
            <!--@if($publishedStatus)-->
            <strong class="publishState out"><span>{$lang->ads->status->published}</span></strong>
            <!--@elseif(!$publishedStatus)-->
            <strong class="publishState"><span>{$lang->ads->status->wait}</span></strong>
            <!--@else-->
            <strong class="publishState draft"><span>{$lang->ads->status->end}</span></strong>
            <!--@end-->
        </td>
        <td>{$curModuleInfo->mid} ({$curModuleInfo->browser_title})</td>
        <td>{cut_str($ad->getTitleText(),100)}</td>
        <td>{$ad->get('nick_name')}</td>
        <td>{zdate($ad->get('regdate'))}</td>
    </tr>
    <!--@if(($ad->get('ad_time') % 10000) === 0)-->
    {@
        $AdTime = $ad->get('ad_time') / 10000;
        $AdTimeUnit = $lang->ads->unit_time->hour;
    }
    <!--@end-->
    {@ $AdType = $ad->get('ad_type')}
    <tr>
        <td class="tLeft itemsRow" colspan="6">
            <ul class="items">
                <!--@if($AdType)--><li>{$lang->ad_type} : <!--@if($AdType == 'linead')-->{$lang->linead}<!--@elseif($AdType == 'banner')-->{$lang->banner}<!--@end--></li><!--@end-->
                <!--@if($AdTime)--><li>{$lang->ad_time} : {$AdTime}{$AdTimeUnit}</li><!--@end-->
                <!--@if($ad->getUrl())--><li>URL : {$ad->getUrl()}</li><!--@end-->
                <!--@if($remainingTime)--><li>{$lang->remaining_time} : {$remainingTime}</li><!--@end-->
            </ul>
        </td>
    </tr>
    <!--@end-->
    <!--@else-->
    <tr>
        <td class="tCenter" colspan="7">{$lang->ads->msg->not_exists_registered_ads}</td>
    </tr>
    <!--@end-->
    </tbody>
</table>

<!-- 페이지 네비게이션 -->
<div class="pagination">
    <a href="{getUrl('page','','module_srl',$module_srl)}" class="prev"><span>{$lang->first_page}</span></a> 
    <!--@while($page_no = $page_navigation->getNextPage())-->
        <!--@if($page == $page_no)-->
            <strong>{$page_no}</strong> 
        <!--@else-->
            <a href="{getUrl('page',$page_no,'module_srl',$module_srl)}">{$page_no}</a> 
        <!--@end-->
    <!--@end-->
    <a href="{getUrl('page',$page_navigation->last_page,'module_srl',$module_srl)}" class="next"><span>{$lang->last_page}</span></a>
</div>

<div class="fr">
    <span class="buttonGray medium strong"><input type="submit" value="{$lang->cmd_delete}" /></span>
</div>